var events = require("events");
var eventEmitter = new events.EventEmitter();
var connected = function connected() {
    console.log("connection successful");
    eventEmitter.emit("data_received");
}
// 监听事件链接
eventEmitter.on("connection", connected)
// 监听数据接受
eventEmitter.on("data_received", function() {
    console.log("data received successful");
})

eventEmitter.emit("connection");

console.log("Program Ended");